<?php
$mt=$_POST["mt"];
call_user_func($mt);
function handle($a,$b,$c)
{
		header("Content-type: text/html; charset=GBK");
		utf8_encode(exec("python ./py/BasicList.py  $a $b $c ",$data));
		return $data;
}

function get_stock_basicinfo()
 {
		   if($_POST){
				$market=$_POST["market"];
				$type=$_POST["type"];
			
				header("Content-type: text/html; charset=GBK");
				utf8_encode(exec("python ./py/BasicList.py basicInfo $market $type ",$data));
				if(empty($data)){
					$data[0]="false";
				}
				echo $data[0];
		 }
		else{ 
				echo '请用post方法访问我！';
		}
 }

function get_trading_days()
{
	    if($_POST)
		{
			$market=$_POST["market"];
			$start_date=$_POST["start_date"];
			$end_date=$_POST["end_date"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py trading $market $start_date  $end_date",$data));
			echo $data;
	   }

}

function get_autype_list()
{
	if($_POST){
			$code_list=$_POST["code_list"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py autype $code_list ",$data));
			echo $data;
	}
 }

function get_history_kline()
{
	if($_POST){
			$code=$_POST["code"];
			$start=$_POST["start"];
			$end=$_POST["end"];
			$ktype=$_POST["ktype"];
			$autype=$_POST["autype"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py hisK $code  $start $end $ktype $autype",$data));
			echo $data;
	}
 }

function get_market_snapshot()
{
	if($_POST)
		{
			$code_list=$_POST["code_list"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py snapshot $code_list ",$data));
			echo $data[0];
     	}
 }
//-----------以上是2.29版-------

//-----------以下是3.32版-------


function get_rt_data()
{
	if($_POST){
			$code=$_POST["code"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  rt_data $code ",$data));
			echo $data;
	}
 }


function get_plate_list()
{
	if($_POST){
			$market=$_POST["market"];
			$plate_class=$_POST["plate_class"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  plate $market  $plate_class",$data));
			echo $data;
	}
 }
 

function get_plate_stock()
{
	if($_POST){
			$market=$_POST["market"];
			$stock_code=$_POST["stock_code"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  stock $market  $stock_code",$data));
			echo $data;
	}
 }


function get_broker_queue()
{
	if($_POST){
			$code=$_POST["code"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  queue $code",$data));
			echo $data;
	}
 }
 

function subscribe()
{
	if($_POST){
			$stock_code=$_POST["stock_code"];
			$data_type=$_POST["data_type"];
			$push=$_POST["push"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  subscribe $stock_code $data_type  $push",$data));
			echo $data;
	}
 }

function unsubscribe()
{
	if($_POST){
			$stock_code=$_POST["stock_code"];
			$data_type=$_POST["data_type"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  unsubscribe $stock_code $data_type",$data));
			echo $data;
	}
 }


function query_subscription()
{
	if($_POST){
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  subscription",$data));
			echo $data;
	}
 }

function get_stock_quote()
{
	if($_POST){
		    $code_list=$_POST["code_list"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  quote $code_list",$data));
			echo $data;
	}
}
 
function get_rt_ticker()
{
	if($_POST){
		    $code_list=$_POST["code_list"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  quote $code_list",$data));
			echo $data;
	}
}

function get_cur_kline()
{
	if($_POST){
		    $code=$_POST["code"];
			$ktype=$_POST["ktype"];
			$autype=$_POST["autype"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  curkline $code $ktype $autype",$data));
			echo $data;
	}
}

function get_order_book()
{
	if($_POST){
		    $code=$_POST["code"];
			header("Content-type: text/html; charset=GBK");
			utf8_encode(exec("python ./py/BasicList.py  curkline $code",$data));
			echo $data;
	 }
}    
?>